Exercises - Maths Operations


Create a program to

  • take the radius of a circle as inut and return the area of the circle
  • take the number of sides on a polygon and return the number of diagonals within the polygon.
  • take the lengths of two sides of a right-angle triangle from the user and apply the Pythagorean Theorem to find the hypotenuse.
  • calculate 2^{2^{2^{2}}}
  • calculate (3+2)^{4}{7}
  • calculate (x + y) * (x + y)
  • calculate 11111111111111111111+22222222222222222222
  • get an integer (n) and computes the value of n+nn+nnn+n0n-(nn/n)*(n%(n-5)). eg: 1+11+111+101 ....
  • get the volume of a sphere with radius n.
  • get the volume of a cone with height h and radius r.
  • get the area of a triangle when base and height is provided
  • compute the greatest common divisor (GCD) of two positive integers
  • compute the least common multiple (LCM) of two positive integers
  • compute the area of polygon when number of sides are provided and length of sides are provided
  • compute the distance between the points (x1, y1) and (x2, y2)
  • write a Python program to print '30+20=50', when x=30 and y=20.

Q 2: True / False

  • All mathematical operations can be performed on Strings
  • Few Mathematical operations can be performed on Strings
  • Addition and Subtraction have same precedence
  • Multiplication and have same precedence
  • Addition and Division have same precedence
  • Multiplication and Subtraction have same precedence
  • Exponential have the highest precedence in the expression
  • Parentheses have the highest precedence in the expression
  • Addition have the highest precedence in the expression
  • Multiplication have the highest precedence in the expression

Q 3: Theory Questions

  • In which order, the Operators with the same precedence are evaluated

In [2]:
radius = int(input("Enter the radius:"))
Area = 3.14 * radius ** 2
print("The area of the circle is " + str(Area) + "cm**2")


Enter the radius:2
The area of the circle is 12.56cm**2